﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_SPHGL_SHUIPINGHGL实体层次
//********************************************************************************//

#region Entity

using System;
using System.Data;
using Entity;
using Oracle.DataAccess.Client;
using Platform.Configuration;
using Platform.Data;

namespace Entity
{
    [Serializable]
    public class YS_SPHGL_SHUIPINGHGL
    {
        private decimal? m_dec_i_jlzt;

        private decimal? m_dec_i_print;

        private decimal? m_dec_i_shuipinghengtype;

        private decimal? m_dec_i_yiwanchengxms;

        private decimal? m_dec_i_zonggaixms;

        private decimal m_dec_id;

        private decimal? m_dec_n_duloul;

        private decimal? m_dec_n_duloutzje;

        private decimal? m_dec_n_dulouxm;

        private decimal? m_dec_n_guanjin;

        private decimal? m_dec_n_jieshuil;

        private decimal? m_dec_n_xinshuil;

        private decimal? m_dec_n_zongtouzije;

        private DateTime? m_DT_d_beianrq;

        private DateTime? m_DT_d_caozuosj;

        private string m_str_s_beiyong1;

        private string m_str_s_beiyong2;

        private string m_str_s_caozuor;

        private string m_str_s_yonghuh;

        /// <summary>
        ///     主键
        /// </summary>
        public decimal ID
        {
            get { return m_dec_id; }
            set { m_dec_id = value; }
        }

        /// <summary>
        ///     用户号
        /// </summary>
        public string S_YONGHUH
        {
            get { return m_str_s_yonghuh; }
            set { m_str_s_yonghuh = value; }
        }

        /// <summary>
        ///     0:正常 -1:删除
        /// </summary>
        public decimal? I_JLZT
        {
            get { return m_dec_i_jlzt; }
            set { m_dec_i_jlzt = value; }
        }

        /// <summary>
        ///     操作人
        /// </summary>
        public string S_CAOZUOR
        {
            get { return m_str_s_caozuor; }
            set { m_str_s_caozuor = value; }
        }

        /// <summary>
        ///     操作时间
        /// </summary>
        public DateTime? D_CAOZUOSJ
        {
            get { return m_DT_d_caozuosj; }
            set { m_DT_d_caozuosj = value; }
        }

        /// <summary>
        ///     备用1
        /// </summary>
        public string S_BEIYONG1
        {
            get { return m_str_s_beiyong1; }
            set { m_str_s_beiyong1 = value; }
        }

        /// <summary>
        ///     备用2
        /// </summary>
        public string S_BEIYONG2
        {
            get { return m_str_s_beiyong2; }
            set { m_str_s_beiyong2 = value; }
        }

        /// <summary>
        ///     打印标志（0代表未打印，1已打印）
        /// </summary>
        public decimal? I_PRINT
        {
            get { return m_dec_i_print; }
            set { m_dec_i_print = value; }
        }

        /// <summary>
        ///     水平衡类型
        /// </summary>
        public decimal? I_SHUIPINGHENGTYPE
        {
            get { return m_dec_i_shuipinghengtype; }
            set { m_dec_i_shuipinghengtype = value; }
        }

        /// <summary>
        ///     总改项目数
        /// </summary>
        public decimal? I_ZONGGAIXMS
        {
            get { return m_dec_i_zonggaixms; }
            set { m_dec_i_zonggaixms = value; }
        }

        /// <summary>
        ///     已完成项目数
        /// </summary>
        public decimal? I_YIWANCHENGXMS
        {
            get { return m_dec_i_yiwanchengxms; }
            set { m_dec_i_yiwanchengxms = value; }
        }

        /// <summary>
        ///     总投资金额（万元）
        /// </summary>
        public decimal? N_ZONGTOUZIJE
        {
            get { return m_dec_n_zongtouzije; }
            set { m_dec_n_zongtouzije = value; }
        }

        /// <summary>
        ///     节水量（m³/d）
        /// </summary>
        public decimal? N_JIESHUIL
        {
            get { return m_dec_n_jieshuil; }
            set { m_dec_n_jieshuil = value; }
        }

        /// <summary>
        ///     堵漏量（m³/d）
        /// </summary>
        public decimal? N_DULOUL
        {
            get { return m_dec_n_duloul; }
            set { m_dec_n_duloul = value; }
        }

        /// <summary>
        ///     堵漏项目数
        /// </summary>
        public decimal? N_DULOUXM
        {
            get { return m_dec_n_dulouxm; }
            set { m_dec_n_dulouxm = value; }
        }

        /// <summary>
        ///     堵漏投资金额（万元）
        /// </summary>
        public decimal? N_DULOUTZJE
        {
            get { return m_dec_n_duloutzje; }
            set { m_dec_n_duloutzje = value; }
        }

        /// <summary>
        ///     管径（mm）
        /// </summary>
        public decimal? N_GUANJIN
        {
            get { return m_dec_n_guanjin; }
            set { m_dec_n_guanjin = value; }
        }

        /// <summary>
        ///     新水量（m³/d）
        /// </summary>
        public decimal? N_XINSHUIL
        {
            get { return m_dec_n_xinshuil; }
            set { m_dec_n_xinshuil = value; }
        }

        /// <summary>
        ///     备案日期
        /// </summary>
        public DateTime? D_BEIANRQ
        {
            get { return m_DT_d_beianrq; }
            set { m_DT_d_beianrq = value; }
        }
    }
}

#endregion

#region EntityProcess

namespace BLL.Access
{
    //using System.Data.OracleClient;

    public class YS_SPHGL_SHUIPINGHGLProcess
    {
        #region Field

        protected string conn;

        #endregion

        #region Construction

        public YS_SPHGL_SHUIPINGHGLProcess()
        {
            conn = ConfigHelper.PlatformConnString;
        }

        #endregion

        #region public

        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL实体添加或者修改YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        public bool InsertOrUpdate(YS_SPHGL_SHUIPINGHGL YS_SPHGL_SHUIPINGHGL, OracleTransaction Transaction)
        {
            if (YS_SPHGL_SHUIPINGHGL.ID == 0)
                InsertYS_SPHGL_SHUIPINGHGL(YS_SPHGL_SHUIPINGHGL, Transaction);
            else
                UpdateYS_SPHGL_SHUIPINGHGL(YS_SPHGL_SHUIPINGHGL, Transaction);
            return YS_SPHGL_SHUIPINGHGL.ID == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL实体添加或修改YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        public bool InsertOrUpdate(YS_SPHGL_SHUIPINGHGL YS_SPHGL_SHUIPINGHGL)
        {
            return InsertOrUpdate(YS_SPHGL_SHUIPINGHGL, null);
        }


        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL主键删除YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_SPHGL_SHUIPINGHGL(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_SPHGL_SHUIPINGHGL";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL主键删除YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_SPHGL_SHUIPINGHGL(decimal ID)
        {
            return DeleteYS_SPHGL_SHUIPINGHGL(ID, null);
        }

        /// <summary>
        ///     根据条件删除YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_SPHGL_SHUIPINGHGLsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据条件删除YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause)
        {
            return DeleteYS_SPHGL_SHUIPINGHGLsDynamic(WhereClause, null);
        }

        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL主键选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public YS_SPHGL_SHUIPINGHGL SelectYS_SPHGL_SHUIPINGHGL(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SPHGL_SHUIPINGHGL";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                var YS_SPHGL_SHUIPINGHGL = PopulateYS_SPHGL_SHUIPINGHGL(rd);
                rd.Close();
                return YS_SPHGL_SHUIPINGHGL;
            }
            return null;
        }

        /// <summary>
        ///     根据YS_SPHGL_SHUIPINGHGL主键选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public YS_SPHGL_SHUIPINGHGL SelectYS_SPHGL_SHUIPINGHGL(decimal ID)
        {
            return SelectYS_SPHGL_SHUIPINGHGL(ID, null);
        }

        /// <summary>
        ///     选择所有YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsAll(OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SPHGL_SHUIPINGHGLsAll";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }

        /// <summary>
        ///     选择所有YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <returns>所有YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsAll()
        {
            return SelectYS_SPHGL_SHUIPINGHGLsAll(null);
        }

        /// <summary>
        ///     根据条件选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause, string OrderByExpression,
            OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SPHGL_SHUIPINGHGLsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectYS_SPHGL_SHUIPINGHGLsDynamic(WhereClause, OrderByExpression, null);
        }


        /// <summary>
        ///     根据条件选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_SPHGL_SHUIPINGHGLsDynPaged";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            storedParams[2].Value = PageIndex;
            storedParams[3].Value = PageSize;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_SPHGL_SHUIPINGHGL信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <returns>YS_SPHGL_SHUIPINGHGL信息</returns>
        public DataTable SelectYS_SPHGL_SHUIPINGHGLsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize)
        {
            return SelectYS_SPHGL_SHUIPINGHGLsDynamic(WhereClause, OrderByExpression, PageIndex, PageSize, null);
        }

        /// <summary>
        ///     根据条件更新YS_SPHGL_SHUIPINGHGL字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_SPHGL_SHUIPINGHGLsDynamic(string UpdateValue, string WhereClause,
            OracleTransaction Transaction)
        {
            var result = 0;
            if (UpdateValue == "" || WhereClause == "")
                return 0;
            var spName = "CS_UpdYS_SPHGL_SHUIPINGHGLDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            result = Convert.ToInt32(storedParams[2].Value);
            return result;
        }

        /// <summary>
        ///     根据条件更新YS_SPHGL_SHUIPINGHGL字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_SPHGL_SHUIPINGHGLsDynamic(string UpdateValue, string WhereClause)
        {
            return UpdateYS_SPHGL_SHUIPINGHGLsDynamic(UpdateValue, WhereClause, null);
        }

        #endregion

        #region Private

        private int InsertYS_SPHGL_SHUIPINGHGL(YS_SPHGL_SHUIPINGHGL YS_SPHGL_SHUIPINGHGL, OracleTransaction Transaction)
        {
            var spName = "CS_InsYS_SPHGL_SHUIPINGHGL";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_SPHGL_SHUIPINGHGL.S_YONGHUH;
            storedParams[1].Value = YS_SPHGL_SHUIPINGHGL.I_JLZT;
            storedParams[2].Value = YS_SPHGL_SHUIPINGHGL.S_CAOZUOR;
            storedParams[3].Value = YS_SPHGL_SHUIPINGHGL.D_CAOZUOSJ;
            storedParams[4].Value = YS_SPHGL_SHUIPINGHGL.S_BEIYONG1;
            storedParams[5].Value = YS_SPHGL_SHUIPINGHGL.S_BEIYONG2;
            storedParams[6].Value = YS_SPHGL_SHUIPINGHGL.I_PRINT;
            storedParams[7].Value = YS_SPHGL_SHUIPINGHGL.I_SHUIPINGHENGTYPE;
            storedParams[8].Value = YS_SPHGL_SHUIPINGHGL.I_ZONGGAIXMS;
            storedParams[9].Value = YS_SPHGL_SHUIPINGHGL.I_YIWANCHENGXMS;
            storedParams[10].Value = YS_SPHGL_SHUIPINGHGL.N_ZONGTOUZIJE;
            storedParams[11].Value = YS_SPHGL_SHUIPINGHGL.N_JIESHUIL;
            storedParams[12].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUL;
            storedParams[13].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUXM;
            storedParams[14].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUTZJE;
            storedParams[15].Value = YS_SPHGL_SHUIPINGHGL.N_GUANJIN;
            storedParams[16].Value = YS_SPHGL_SHUIPINGHGL.N_XINSHUIL;
            storedParams[17].Value = YS_SPHGL_SHUIPINGHGL.D_BEIANRQ;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            YS_SPHGL_SHUIPINGHGL.ID = Convert.ToInt32(storedParams[18].Value);
            return result;
        }

        private bool UpdateYS_SPHGL_SHUIPINGHGL(YS_SPHGL_SHUIPINGHGL YS_SPHGL_SHUIPINGHGL,
            OracleTransaction Transaction)
        {
            var spName = "CS_UpdYS_SPHGL_SHUIPINGHGL";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_SPHGL_SHUIPINGHGL.S_YONGHUH;
            storedParams[1].Value = YS_SPHGL_SHUIPINGHGL.I_JLZT;
            storedParams[2].Value = YS_SPHGL_SHUIPINGHGL.S_CAOZUOR;
            storedParams[3].Value = YS_SPHGL_SHUIPINGHGL.D_CAOZUOSJ;
            storedParams[4].Value = YS_SPHGL_SHUIPINGHGL.S_BEIYONG1;
            storedParams[5].Value = YS_SPHGL_SHUIPINGHGL.S_BEIYONG2;
            storedParams[6].Value = YS_SPHGL_SHUIPINGHGL.I_PRINT;
            storedParams[7].Value = YS_SPHGL_SHUIPINGHGL.I_SHUIPINGHENGTYPE;
            storedParams[8].Value = YS_SPHGL_SHUIPINGHGL.I_ZONGGAIXMS;
            storedParams[9].Value = YS_SPHGL_SHUIPINGHGL.I_YIWANCHENGXMS;
            storedParams[10].Value = YS_SPHGL_SHUIPINGHGL.N_ZONGTOUZIJE;
            storedParams[11].Value = YS_SPHGL_SHUIPINGHGL.N_JIESHUIL;
            storedParams[12].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUL;
            storedParams[13].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUXM;
            storedParams[14].Value = YS_SPHGL_SHUIPINGHGL.N_DULOUTZJE;
            storedParams[15].Value = YS_SPHGL_SHUIPINGHGL.N_GUANJIN;
            storedParams[16].Value = YS_SPHGL_SHUIPINGHGL.N_XINSHUIL;
            storedParams[17].Value = YS_SPHGL_SHUIPINGHGL.D_BEIANRQ;
            storedParams[18].Value = YS_SPHGL_SHUIPINGHGL.ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }


        private YS_SPHGL_SHUIPINGHGL PopulateYS_SPHGL_SHUIPINGHGL(IDataReader dr)
        {
            var YS_SPHGL_SHUIPINGHGL = new YS_SPHGL_SHUIPINGHGL();
            YS_SPHGL_SHUIPINGHGL.ID = dr["ID"] == DBNull.Value ? 0 : (decimal) dr["ID"];
            YS_SPHGL_SHUIPINGHGL.S_YONGHUH = dr["S_YONGHUH"] == DBNull.Value ? null : (string) dr["S_YONGHUH"];
            YS_SPHGL_SHUIPINGHGL.I_JLZT = dr["I_JLZT"] == DBNull.Value ? null : (decimal?) dr["I_JLZT"];
            YS_SPHGL_SHUIPINGHGL.S_CAOZUOR = dr["S_CAOZUOR"] == DBNull.Value ? null : (string) dr["S_CAOZUOR"];
            YS_SPHGL_SHUIPINGHGL.D_CAOZUOSJ = dr["D_CAOZUOSJ"] == DBNull.Value ? null : (DateTime?) dr["D_CAOZUOSJ"];
            YS_SPHGL_SHUIPINGHGL.S_BEIYONG1 = dr["S_BEIYONG1"] == DBNull.Value ? null : (string) dr["S_BEIYONG1"];
            YS_SPHGL_SHUIPINGHGL.S_BEIYONG2 = dr["S_BEIYONG2"] == DBNull.Value ? null : (string) dr["S_BEIYONG2"];
            YS_SPHGL_SHUIPINGHGL.I_PRINT = dr["I_PRINT"] == DBNull.Value ? null : (decimal?) dr["I_PRINT"];
            YS_SPHGL_SHUIPINGHGL.I_SHUIPINGHENGTYPE = dr["I_SHUIPINGHENGTYPE"] == DBNull.Value
                ? null
                : (decimal?) dr["I_SHUIPINGHENGTYPE"];
            YS_SPHGL_SHUIPINGHGL.I_ZONGGAIXMS =
                dr["I_ZONGGAIXMS"] == DBNull.Value ? null : (decimal?) dr["I_ZONGGAIXMS"];
            YS_SPHGL_SHUIPINGHGL.I_YIWANCHENGXMS =
                dr["I_YIWANCHENGXMS"] == DBNull.Value ? null : (decimal?) dr["I_YIWANCHENGXMS"];
            YS_SPHGL_SHUIPINGHGL.N_ZONGTOUZIJE =
                dr["N_ZONGTOUZIJE"] == DBNull.Value ? null : (decimal?) dr["N_ZONGTOUZIJE"];
            YS_SPHGL_SHUIPINGHGL.N_JIESHUIL = dr["N_JIESHUIL"] == DBNull.Value ? null : (decimal?) dr["N_JIESHUIL"];
            YS_SPHGL_SHUIPINGHGL.N_DULOUL = dr["N_DULOUL"] == DBNull.Value ? null : (decimal?) dr["N_DULOUL"];
            YS_SPHGL_SHUIPINGHGL.N_DULOUXM = dr["N_DULOUXM"] == DBNull.Value ? null : (decimal?) dr["N_DULOUXM"];
            YS_SPHGL_SHUIPINGHGL.N_DULOUTZJE = dr["N_DULOUTZJE"] == DBNull.Value ? null : (decimal?) dr["N_DULOUTZJE"];
            YS_SPHGL_SHUIPINGHGL.N_GUANJIN = dr["N_GUANJIN"] == DBNull.Value ? null : (decimal?) dr["N_GUANJIN"];
            YS_SPHGL_SHUIPINGHGL.N_XINSHUIL = dr["N_XINSHUIL"] == DBNull.Value ? null : (decimal?) dr["N_XINSHUIL"];
            YS_SPHGL_SHUIPINGHGL.D_BEIANRQ = dr["D_BEIANRQ"] == DBNull.Value ? null : (DateTime?) dr["D_BEIANRQ"];
            return YS_SPHGL_SHUIPINGHGL;
        }


        private void AddRowNumber(DataTable dt)
        {
            dt.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            for (var i = 0; i < dt.Rows.Count; i++)
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
        }

        #endregion
    }
}

#endregion